package com.se.domain.dto.page;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageDTO {

    @NotNull(message = "页号不可为空")
    @Min(value = 0, message = "页号不可小于0")
    Integer page;

    @NotNull(message = "每页数量不可为空")
    @Max(value = 100, message = "每页数量不可大于100")
    Integer size;

    public int limitStart(){
        return this.page * this.size;
    }
}
